// 品牌管理接口
// 统一管理用户相关接口
import http from '@/utils/request'

import type { trademarkListType, listType, trademarkItemType } from './type'

// 通过枚举统一管理接口
enum API {
  TRADEMARK_URL = '/admin/product/baseTrademark',
  ADDTRADEMARK_URL = '/admin/product/baseTrademark/save',
  EDITTRADEMARK_URL = '/admin/product/baseTrademark/update',
  REMOVETRADEMARK_URL = '/admin/product/baseTrademark/remove',
  TRADEMARKITEM_URL = '/admin/product/baseTrademark/get',
}

/**
 * 获取已有的品牌列表
 * page：第几页
 * limit：每页几条数据
 */
export const getTrademarkAPI = (page: number, limit: number) => http.get<any, trademarkListType>(API.TRADEMARK_URL + `/${page}/${limit}`)

/**
 * 新增品牌
 * data：新增的数据
 */
export const addTrademarkAPI = (data: listType) => http.post<any, any>(API.ADDTRADEMARK_URL, data)

/**
 * 修改品牌
 * data：新增的数据
 */
export const editTrademarkAPI = (data: listType) => http.put<any, any>(API.EDITTRADEMARK_URL, data)

/**
 * 获取品牌详情
 * id：数据id
 */
export const getTrademarkItemAPI = (id: string) => http.get<any, trademarkItemType>(API.TRADEMARKITEM_URL + `/${id}`)

/**
 * 删除品牌
 * id：数据id
 */
export const removeTrademarkItemAPI = (id: string) => http.delete<any, any>(API.REMOVETRADEMARK_URL + `/${id}`)
